/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.opgea.appstreet.domain.entities;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ramesh
 */
@Entity
@Table(name = "companylogin")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CompanyLogin.findAll", query = "SELECT c FROM CompanyLogin c"),
    @NamedQuery(name = "CompanyLogin.findById", query = "SELECT c FROM CompanyLogin c WHERE c.id = :id"),
    @NamedQuery(name = "CompanyLogin.findByIsActive", query = "SELECT c FROM CompanyLogin c WHERE c.isActive = :isActive"),
    @NamedQuery(name = "CompanyLogin.findByLoginId", query = "SELECT c FROM CompanyLogin c WHERE c.loginId = :loginId"),
    @NamedQuery(name = "CompanyLogin.findByPassword", query = "SELECT c FROM CompanyLogin c WHERE c.password = :password")})
public class CompanyLogin implements Serializable {
    
    @Id
    //@GeneratedValue
    //private Long id;
    private String loginId;
    private String password;
    private boolean isActive;
    @OneToOne(cascade= CascadeType.ALL)
    private Company company;

    public CompanyLogin() {
    }

    public Company getCompany() {
        return company;
    }

    public void setCompany(Company company) {
        this.company = company;
    }

    /*
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }*/

    public boolean isIsActive() {
        return isActive;
    }

    public void setIsActive(boolean isActive) {
        this.isActive = isActive;
    }

    public String getLoginId() {
        return loginId;
    }

    public void setLoginId(String loginId) {
        this.loginId = loginId;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final CompanyLogin other = (CompanyLogin) obj;
        if ((this.loginId == null) ? (other.loginId != null) : !this.loginId.equals(other.loginId)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 11 * hash + (this.loginId != null ? this.loginId.hashCode() : 0);
        return hash;
    }

    @Override
    public String toString() {
        return "CompanyLogin{" + "loginId=" + loginId + ", password=" + password + ", isActive=" + isActive + ", company=" + company + '}';
    }

   
    
    
}
